package duckandturkey.duck;

import duckandturkey.turkey.Turkey;

/**
 * description:
 *  火鸡兼容鸭子适配器
 * @author yuanmenglv on 2019/11/30
 */
public class TurkeyToDuckAdapter implements Duck {
    private Turkey turkey;

    public TurkeyToDuckAdapter(Turkey turkey) {
        this.turkey = turkey;
    }

    @Override
    public void quack() {
        turkey.gobble();
    }

    @Override
    public void fly() {
        for ( int i = 0; i < 5; i++ ) {
            turkey.fly();
        }
    }
}
